/*
package com.example.demo.listToTree;

import com.alibaba.fastjson.JSON;
import com.example.demo.Apple;
import java.lang.reflect.Field;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Zone> zoneList = new ArrayList<>();
        zoneList.add(new Zone("1", "上海", "0"));
        zoneList.add(new Zone("2", "北京", "0"));
        ZoneUtils.test(zoneList);



        List<Object> ls = new ArrayList<>();
        ls.add(new Zone("1", "上海", "0"));
        ls.add(new Zone("2", "北京", "0"));
        for (int i = 0; i < ls.size(); i++) {
            Object o = ls.get(i);
            Class<?> clazz = o.getClass();
            Field[] fs = clazz.getDeclaredFields();// 获取他的字段数组
            for (int j = 0; j < fs.length; j++) {
                Field f = fs[i];
                f.setAccessible(true); // 设置些属性是可以访问的
                Object val = new Object();
                try {
                    val = f.get(o);
                    f.getName();
                    // 得到此属性的值
                   // map.put(f.getName(), val);// 设置键值
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }



       */
/* List<Apple> appList = new ArrayList<>();

        Apple apple1 = new Apple();
        apple1.setId(1);
        apple1.setName("苹果11");
        apple1.setNum(123);
        appList.add(apple1);
        ZoneUtils.test(appList);*//*

        */
/*zoneList.add(new Zone("3", "河南", "0"));
        zoneList.add(new Zone("31", "郑州", "3"));
        zoneList.add(new Zone("32", "洛阳", "3"));
        zoneList.add(new Zone("321", "洛龙", "32"));
        zoneList.add(new Zone("11", "松江", "1"));
        zoneList.add(new Zone("111", "泗泾", "11"));*//*

      */
/*  System.out.println("=======================2========================");
        List<Zone> rootZone2 = ZoneUtils.buildTree2(zoneList); // 测试第二种方法
        rootZone2.stream().forEach(item -> System.out.println(JSON.toJSONString(item)));
        System.out.println("===========================3====================");
        List<Zone> rootZone3 = ZoneUtils.buildTree3(zoneList); // 测试第三种方法
        rootZone3.stream().forEach(item -> System.out.println(JSON.toJSONString(item)));*//*

        System.out.println("===========================4===================");
        //List<Zone> rootZone3_01 = ZoneUtils.buildTree3_01(zoneList); // 测试第三种方法
        //System.out.println(JSON.toJSONString(rootZone3_01));

       //rootZone3_01.stream().forEach(item -> System.out.println(JSON.toJSONString(item)));

    }
}*/
